<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <button>我要发送消息给你父窗口了哈</button>
</body>
<script>
  "use strict";
  document.querySelector("button").addEventListener("click", async () => {
    window.opener.postMessage(`我来了，老弟！`);
  });
</script>

</html>